package com.wanmait.baohan.controller.capitalController;

import com.github.pagehelper.PageInfo;
import com.wanmait.baohan.pojo.CapitalExpenditure;
import com.wanmait.baohan.service.CapitalExpenditureService;
import com.wanmait.baohan.service.CapitalService;
import com.wanmait.baohan.service.CapitalTypeService;
import com.wanmait.baohan.vo.DataVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


import javax.annotation.Resource;
import java.util.List;

/**
李建文
*/
@Controller
@RequestMapping("/capitalExpenditure")
public class CapitalExpenditureController {

    @Resource
    CapitalService capitalService;

    @Resource
    CapitalTypeService capitalTypeService;


    @Resource
    CapitalExpenditureService capitalExpenditureService;

    @RequestMapping("fund")
    public void fund(){

        System.out.println("111111");

    }

    //获得所有的资金记录
    @RequestMapping("/getData")
    @ResponseBody
    public DataVo<CapitalExpenditure> capitalExpenditureList(Integer page, Integer limit){
        PageInfo<CapitalExpenditure> pageInfo = capitalExpenditureService.selectAllCapitalExpenditure(page,limit);

        DataVo<CapitalExpenditure> dataVo = new DataVo<>();
        List<CapitalExpenditure> capitalExpenditureList = pageInfo.getList();
        dataVo.setData(capitalExpenditureList);
        dataVo.setCount(pageInfo.getTotal());
        return dataVo;
    }

//
//    @RequestMapping("getData")
//    @ResponseBody
//    public DataVo<CapitalExpenditure> capitalExpenditureList(){
//        System.out.println("getData111111111111111111111111111");
//        DataVo<CapitalExpenditure> dataVo = new DataVo<>();
//        List<CapitalExpenditure> list = capitalExpenditureService.findAll();
//        //System.out.println(pageInfo.getList().get(0).getId());
////        dataVo.setData(capitalExpenditureList);
////        dataVo.setCount(pageInfo.getTotal());
//        return dataVo;
//    }




}
